package itqf.service;



import itqf.dao.ProductDaoImpl;
import itqf.dao.impl.ProductDao;
import itqf.entity.Product;
import itqf.service.impl.ProductService;
import itqf.utils.PageBean;

import java.util.List;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/9/15
 * @Time: 下午4:41
 */
public class ProductServiceImpl  implements ProductService {

    ProductDao productDao = new ProductDaoImpl();

    @Override
    public PageBean findProductByTypeId(int typeId, int startIndex, int pageSize) {
      long totalCount = productDao.findTotalProductByTypeId(typeId);

      List<Product> list = productDao.findProductByTypeId(startIndex,pageSize,typeId);

      PageBean bean = new PageBean();
      bean.setList(list);
      bean.setTotalCount(totalCount);

      return bean;
    }

    @Override
    public Product finProductDetailById(int id) {
        return productDao.findProductById(id);
    }

    @Override
    public List<Product> showGoodsType() {
        return productDao.showGoodsType();
    }

    @Override
    public List<Product> showAllProduct() {
        return productDao.showAllProduct();
    }
}
